cmake_minimum_required(VERSION 3.16)

project(lplogger)

list(APPEND HEADERS include/lp_logger.h)
list(APPEND HEADERS include/lp_logger_default.h)
list(APPEND SOURCES src/lp_logger.c)
list(APPEND SOURCES src/lp_asserts.h)
list(APPEND SOURCES src/lp_logger_default.c)
list(APPEND SOURCES src/lp_sink_console.c)
list(APPEND SOURCES src/lp_sink_localfile.c)
list(APPEND SOURCES src/lp_list_head.h)
list(APPEND SOURCES src/lp_formatlist.h)
list(APPEND SOURCES src/lp_formatlist.c)
list(APPEND SOURCES src/lp_buffer.c)

add_library(lplogger SHARED ${HEADERS} ${SOURCES})
target_include_directories(lplogger PRIVATE include src)
set_target_properties(lplogger PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/lib)

set(CMAKE_CXX_STANDARD 20)
add_executable(lplogger_test test/main.cpp)
target_include_directories(lplogger_test PRIVATE include)
target_link_libraries(lplogger_test PRIVATE -L${CMAKE_CURRENT_LIST_DIR}/lib -llplogger)
add_dependencies(lplogger_test lplogger)
